# -*- coding: utf-8 -*-

from django.contrib.auth.models import User
from django.db import models
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class UserProfile(models.Model):
    """
    用户扩展表：
    user:    用户
    nickname:昵称
    avtor:   用户头像
    signature:用户签名
    """

    # This line is required. Links UserProfile to a User model instance.
    user = models.OneToOneField(User)
    # The additional attributes we wish to include.
    nickname = models.CharField(max_length=64, blank=True)
    # avtor = models.ImageField(upload_to='avtor', blank=True,default='/static/dist/img/user2-160x160.jpg')
    signature = models.CharField(
        max_length=256,
        blank=True,
        verbose_name=u'个性签名')
    settings = models.CharField(
        max_length=1024,
        blank=True,
        null=True
    )

    def __str__(self):
        return self.user.username
